<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:p="http://primefaces.org/ui" xmlns:a4j="http://richfaces.org/a4j"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<f:metadata>
 		<f:event listener="#{HataCozumuBean.verifyProducer}" type="preRenderView"/>		
	</f:metadata>
</h:head>
<h:body>
	<ui:composition template="template.xhtml">

		<ui:define name="title">mehmet emmy</ui:define>
		<ui:define name="body">
			<c:if test="${sessionScope.currentKullanici.grup != 2}">
				<script language="javascript">
                    	alert("bu sayfaya erişim yetkiniz yoktur.")
    					redirectPage();
	  	 			</script>
			</c:if>			
			<h:form id="formHtCzList">
				
				<p:growl id="msgs" showDetail="true" />
				<c:choose>
					<c:when test="${HataCozumuBean.hataCzIslem &amp;&amp; 
						HataCozumuBean.selectedHataCozum.sirketprofil.firmaid==SirketprofilBean.currentSirketpro.firmaid}">
						<p:commandButton id="backButton" value="Geri Dön" icon="ui-icon-search"
									actionListener="#{HataCozumuBean.hataCozumIslem(false)}"
									update=":formHtCzList" />
						<h:panelGrid columns="2">

							<h:outputLabel value="Firma Adı" />
							<h:inputText  id="firmaAd" 
									value="#{HataCozumuBean.selectedHataCozum.sirketprofil.firmaAd}" 
									disabled="true" readonly="true"/>
							
							<h:outputLabel value="Hata Kodu" />
							<h:inputText  id="hatakodu" 
									value="#{HataCozumuBean.selectedHataCozum.hataKodu}"/>					
							
							<h:outputLabel value="Ürün" />
							<p:selectOneMenu value="#{HataCozumuBean.selectedHataCozum.aygit}" 
								converter="AygitConverter" required="true" 
                         		effect="fade" var="a">  
            					<f:selectItems value="#{AygitBean.aygitList}" 
            						var="aygit" itemLabel="#{aygit.model}" itemValue="#{aygit}" />                				 
  
					            <p:column>  
                					#{a.marka} - #{a.model}
            					</p:column>  
        					</p:selectOneMenu> 
									
							<h:outputLabel value="Çözüm Açıklama" />
							<h:inputText  id="czAciklama" 
									value="#{HataCozumuBean.selectedHataCozum.cozumAciklamasi}"/>
							
							<h:outputLabel/>		
							<p:commandButton value="Save" actionListener="#{HataCozumuBean.hataCozumIslem(false)}"
								action="#{HataCozumuBean.SaveOrUpdate}" update=":formHtCzList" />
						</h:panelGrid>
					</c:when>
					<c:otherwise>
						<p:dataTable id="hataCozumTable" var="hataCozum" widgetVar="hataCozumTable"
							emptyMessage="Not found with given criteria"
							value="#{HataCozumuBean.hataCozumList}" tableStyle="width:auto"
							paginator="true" rows="10" liveScroll="true"
							rowKey="#{hataCozum.htid}"
							selection="#{HataCozumuBean.selectedHataCozum}"
							selectionMode="single">
							
							<f:facet name="header">
								<p:outputPanel>
									<h:outputText value="Search all fields:" />
									<p:inputText id="globalFilter" onkeyup="hataCozumTable.filter()"
										style="width:150px"/>
								</p:outputPanel>
							</f:facet>
							
							<p:column headerText="Firma Adı" 
								filterBy="#{HataCozumuBean.selectedHataCozum.sirketprofil.firmaAd}" 
								filterMatchMode="contains" footerText="contains" style="width:100px" >
								<h:outputText value="#{hataCozum.sirketprofil.firmaAd}" />
							</p:column>

							<p:column headerText="Hata Kodu" style="width:100px"
								filterMatchMode="contains" footerText="contains" 
								filterBy="#{HataCozumuBean.selectedHataCozum.hataKodu}">
								<h:outputText value="#{hataCozum.hataKodu}" />
							</p:column>

							<p:column headerText="Ürün" style="width:100px"
								filterMatchMode="contains" footerText="contains"
								filterBy="#{hataCozum.aygit.marka} - #{hataCozum.aygit.model}">
								<h:outputText value="#{hataCozum.aygit.marka} - #{hataCozum.aygit.model}" />
							</p:column>

							<f:facet name="footer">
								<p:commandButton id="editButton" value="Edit" icon="ui-icon-search"
									action="#{HataCozumuBean.hataCozumIslem(true)}"
									actionListener="#{AygitBean.getUreticiAygitlari(SirketprofilBean.currentSirketpro)}"
									update=":formHtCzList" />
							</f:facet>
							<f:facet name="footer">
								<p:commandButton id="deleteButton" value="Delete" icon="ui-icon-search" 
									actionListener="#{HataCozumuBean.deleteView}"
									update=":formHtCzList" />
							</f:facet>
							<f:facet name="footer">
								<p:commandButton id="newButton" value="Add New" icon="ui-icon-search" 
									action="#{HataCozumuBean.viewNew}"
									actionListener="#{AygitBean.getUreticiAygitlari(SirketprofilBean.currentSirketpro)}"									
									update=":formHtCzList" />
							</f:facet>
						</p:dataTable>
					</c:otherwise>
				</c:choose>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>